@isTest
private class testWarrantyRegistration {

    static testMethod void warrantyRegistrationTest() 
    {   
		warrantyRegistrationController controller = new warrantyRegistrationController();		
		warrantyRegistrationController.purchasedProductInfo purchasedProductInfo;
		warrantyRegistrationController.custInfo custInfo = new warrantyRegistrationController.custInfo();
		
		for(Integer i=0;i<2;i++)
		{
			purchasedProductInfo = new warrantyRegistrationController.purchasedProductInfo(i);	
			Account acctPerson = new Account();			
			acctPerson.PersonBirthdate = system.today();
			purchasedProductInfo.proxyDatePurchaseObject = 	acctPerson;
			purchasedProductInfo.proxyDateDeliveryObject = acctPerson;
			Purchased_Product__c purchasedProd = new Purchased_Product__c();	
			purchasedProd.Product_Type__c = 'Hob';
			purchasedProductInfo.purchasedProduct = purchasedProd;
		}
		controller.listpurchasedProductInfo.add(purchasedProductInfo);
		Account newAcct = new Account();
		newAcct.FirstName='test';
		newAcct.LastName='test';
		newAcct.Phone='test';
		newAcct.Flat_Unit_Room_Suite__c = 'Flat';
		newAcct.Block_Tower_House_Shop_Lot_Billing__c = 'Lot';
		newAcct.Flat_No__c='1';
		newAcct.Floor_No__c='1';
		newAcct.Tower_Block_No__c='1';
		custInfo.acct = newAcct;
		controller.objCustomerInfo = custInfo;

		controller.doSubmit(); 
		controller.doCancel();
		test.startTest();
        controller.doConfirm();
        test.stopTest();               
    }

	static testMethod void warrantyRegistrationTest2() 
    {    	
		warrantyRegistrationController controller = new warrantyRegistrationController();		
		warrantyRegistrationController.purchasedProductInfo purchasedProductInfo;
		warrantyRegistrationController.custInfo custInfo = new warrantyRegistrationController.custInfo();
		
		for(Integer i=0;i<2;i++)
		{
			purchasedProductInfo = new warrantyRegistrationController.purchasedProductInfo(i);	
			Account acctPerson = new Account();			
			acctPerson.PersonBirthdate = system.today();
			purchasedProductInfo.proxyDatePurchaseObject = 	acctPerson;	
			purchasedProductInfo.proxyDateDeliveryObject = acctPerson;			
			Purchased_Product__c purchasedProd = new Purchased_Product__c();	
			purchasedProd.Product_Type__c = '';
			purchasedProductInfo.purchasedProduct = purchasedProd;
		}
		controller.listpurchasedProductInfo.add(purchasedProductInfo);
		Account newAcct = new Account();
		newAcct.FirstName='test';
		newAcct.LastName='test';
		newAcct.Phone='test';
		newAcct.Flat_Unit_Room_Suite__c = 'Flat';
		newAcct.Block_Tower_House_Shop_Lot_Billing__c = 'Lot';
		newAcct.Flat_No__c='1';
		newAcct.Floor_No__c='1';
		newAcct.Tower_Block_No__c='1';
		custInfo.acct = newAcct;
		controller.objCustomerInfo = custInfo;
		controller.doSubmit(); 
        test.startTest();
        controller.doConfirm();
        test.stopTest();        
    }
    
    static testMethod void warrantyRegistrationTest3() 
    {    	
		warrantyRegistrationController controller = new warrantyRegistrationController();		
		warrantyRegistrationController.purchasedProductInfo purchasedProductInfo;
		warrantyRegistrationController.custInfo custInfo = new warrantyRegistrationController.custInfo();
		
		for(Integer i=0;i<2;i++)
		{
			purchasedProductInfo = new warrantyRegistrationController.purchasedProductInfo(i);	
			Account acctPerson = new Account();		
			Account acctPerson2 = new Account();		
			acctPerson.PersonBirthdate = null;
			acctPerson2.PersonBirthdate = system.today();
			purchasedProductInfo.proxyDatePurchaseObject = 	acctPerson;	
			purchasedProductInfo.proxyDateDeliveryObject = acctPerson2;
			Purchased_Product__c purchasedProd = new Purchased_Product__c();	
			purchasedProd.Product_Type__c = 'Hob';
			purchasedProductInfo.purchasedProduct = purchasedProd;
		}
		controller.listpurchasedProductInfo.add(purchasedProductInfo);
		Account newAcct = new Account();
		newAcct.FirstName='test';
		newAcct.LastName='test';
		newAcct.Phone='test';
		newAcct.Flat_No__c=null;
		newAcct.Floor_No__c=null;
		newAcct.Tower_Block_No__c=null;
		custInfo.acct = newAcct;
		controller.objCustomerInfo = custInfo;
		controller.doSubmit(); 
        test.startTest();
        controller.doConfirm(); 
        test.stopTest();        
    }
    static testMethod void warrantyRegistrationTest4() 
    {    	
		warrantyRegistrationController controller = new warrantyRegistrationController();		
		warrantyRegistrationController.purchasedProductInfo purchasedProductInfo;
		warrantyRegistrationController.custInfo custInfo = new warrantyRegistrationController.custInfo();
		
		for(Integer i=0;i<2;i++)
		{
			purchasedProductInfo = new warrantyRegistrationController.purchasedProductInfo(i);	
			Account acctPerson = new Account();			
			acctPerson.PersonBirthdate = null;
			purchasedProductInfo.proxyDatePurchaseObject = 	acctPerson;	
			purchasedProductInfo.proxyDateDeliveryObject = acctPerson;
			Purchased_Product__c purchasedProd = new Purchased_Product__c();	
			purchasedProductInfo.purchasedProduct = purchasedProd;
		}
		controller.listpurchasedProductInfo.add(purchasedProductInfo);
		controller.doSubmit(); 
        test.startTest();
        controller.doConfirm();
        test.stopTest();       
    }
}